package cn.edu.hzvtc.dao;

import cn.edu.hzvtc.pojo.User;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserMapper {
    //根据用户名和密码获取用户对象
    List<User> selectByNameAndPassword(@Param("userName") String userName, @Param("userPassword") String userPassword);

    //实现获取登录用户功能
    User loginUser(User user);

    //数据查询将关联的操作人和所属区域信息
    List<User> selectAreaAdmins(@Param("provinceId") Integer provinceId, @Param("cityId") Integer cityId, @Param("schoolId") Integer schoolId, @Param("userName") String userName);


    //根据id删除
    int delStateByPrimaryKey(Integer id);

    //批量删除
    int delStatesByList(@Param("ids") List<Integer> ids);

    //查找修改id
    User selectAreaAdminById(Integer id);

    //重置密码
    int resetPasswordByPrimaryKey(Integer id);

    //获取数量
    Long getCount(Integer userAreaId);

    //数据查询将关联的用户信息
    List<User> selectUsers(@Param("unitTypeId") Integer unitTypeId, @Param("unitId") Integer unitId, @Param("userName") String userName,@Param("userAreaId") Integer userAreaId);

    //根据id，查询用户
    User selectUserById(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_user
     *
     * @mbg.generated Fri Sep 10 14:43:06 CST 2021
     */
    int deleteByPrimaryKey(Integer id);



    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_user
     *
     * @mbg.generated Fri Sep 10 14:43:06 CST 2021
     */
    int insert(User record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_user
     *
     * @mbg.generated Fri Sep 10 14:43:06 CST 2021
     */
    User selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_user
     *
     * @mbg.generated Fri Sep 10 14:43:06 CST 2021
     */
    List<User> selectAll();

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_user
     *
     * @mbg.generated Fri Sep 10 14:43:06 CST 2021
     */
    int updateByPrimaryKey(User record);

    //修改用户部门分配
    int deleteUnitsByUserId(Integer userId);

    int insertUnitsByUserId(@Param("userId") Integer userId,@Param("unitIds") List<Integer> unitIds);



}